<template>
	<view>
		<view class="header status_bar">
			<view class="back iconfont" @tap="backPage">&#xe779;</view>
			<view class="text">提现</view>
		</view>
		<view class="clear_box"></view>

		<view class="account">
			<view class="text">姓名</view>
			<input type="text" value="" placeholder="请输入姓名" v-model="name" />
		</view>
		
		<view class="account">
			<view class="text">开户银行</view>
			<input type="text" value="" placeholder="请输入开户银行" v-model="bank" />
		</view>
		
		<view class="account">
			<view class="text">银行卡号</view>
			<input type="text" value="" placeholder="请输入银行卡号" v-model="bankNum" />
		</view>

		<!-- <view class="account" :data-index="1" @tap="setNavMenu">
			<view class="icon iconfont">&#xe629;</view>
			<view class="text">提现到支付宝</view>
			<view class="tick iconfont" :class="select == 1 ? 'tickColor' : ''">&#xe616;</view>
		</view> -->

		<view class="carry_title">提现金额</view>
		<view class="input_box">
			<view class="text">￥</view>
			<input type="number" placeholder="请输入" v-model="inputMoney" />
			<view class="all" @tap="setMoney">全部</view>
		</view>
		<view class="carry_text">可提现金额:￥{{money}}</view>

		<button class="confirm02" @tap="getMoney">确认</button>
		<view class="carry_text02">温馨提示：提现申请后请等待后台审核</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			select: -1,
			money:'',
			inputMoney:'',
			name:'',
			bank:'',
			bankNum:'',
		};
	},
	onLoad(e) {
		let that = this;
		that.money = e.money;
	},
	methods: {
		getMoney(){
			let that = this;
			
			if (!that.name) {
				that.Msg.Fail('请输入姓名');
				return;
			}
			
			if (!that.bank) {
				that.Msg.Fail('请输入开户银行');
				return;
			}
			
			if (!that.bankNum) {
				that.Msg.Fail('请输入银行卡号');
				return;
			}
			
			if (that.money == 0) {
				that.Msg.Fail('暂无可提现金额');
				return;
			}
			
			if (!that.inputMoney) {
				that.Msg.Fail('请输入提现金额');
				return;
			}
			
			that.Net._post('user_cash', { money: that.inputMoney,name:that.name,bank_name:that.bank,card_no:that.bankNum}, res => {
				if (res.code == 200) {
					that.Msg.Success('提现申请已提交', res => {
						uni.navigateBack({});
					});
				} else if (res.code != 200) {
					that.Msg.Success(res.msg, res => {});
				}
			});
			
		},
		setMoney(){
			let that = this;
			that.inputMoney = that.money;
		},
		backPage() {
			uni.navigateBack({});
		},
		gotopage(e) {
			let url = e.currentTarget.dataset.url;
			uni.navigateTo({
				url: url
			});
		},
		setNavMenu(e) {
			let index = e.currentTarget.dataset.index;
			this.select = index;
		}
	}
};
</script>

<style>
	page{

	}
.tickColor {
	color: #ff5301 !important;
}

.account {
	width: 92%;
	margin: 0 auto;
	display: flex;
	align-items: center;
	border-radius: 2vw;
	margin-top: 3vw;
	padding: 4vw 0;
	background-color: #fff;
}


.account .text {
	font-size: 3.5vw;
	color: #333;
	font-weight: bold;
	margin-right: 2vw;
}

.account input {
	font-size: 3.5vw;
	color: #333;
	flex: 1;
}

.carry_title {
	width: 92%;
	margin: 0 auto;
	font-size: 3.5vw;
	color: #333;
	margin-top: 6vw;
}

.carry_text {
	width: 92%;
	margin: 0 auto;
	font-size: 3vw;
	color: #999;
	margin-top: 6vw;
}

.carry_text02 {
	width: 92%;
	margin: 0 auto;
	font-size: 3vw;
	color: #999;
	margin-top: 3vw;
	text-align: center;
}

.input_box {
	width: 92%;
	margin: 0 auto;
	display: flex;
	height: 13.5vw;
	margin-top: 3vw;
}

.input_box .text {
	font-size: 8vw;
	color: #333;
	line-height: 13.5vw;
}

.input_box input {
	flex: 1;
	height: 13.5vw;
	font-size: 8vw;
	color: #333;
}

.input_box .all {
	font-size: 4vw;
	color: #333;
	width: 13vw;
	line-height: 13.5vw;
	text-align: right;
}
</style>
